<?php session_start(); 
ob_start();
?>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="public/css.css">

        <title>Facebook</title>
    </head>

<?php
require_once './model/works.php';
$works = new works();
$work = $works->select(NULL, $_GET['id']);
?>

  <?php if (isset($_SESSION['id']) && $_SESSION['id'] == 1) : ?>
<form  action="edit.php?id=<?php echo $_GET["id"] ?>" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <label for="file">Name:</label>
    <input type="text" name="name" value="<?php echo $work["name"] ?>"><br>
    <label for="altText">Description</label><br>
    <textarea name="description" rows="10" cols="50">
    <?php 
    //string html_entity_decode ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = 'UTF-8' ]] )
    ?>
        <?php echo html_entity_decode($work["description"],ENT_COMPAT ,'UTF-8'); ?></textarea> <br>
    <input type="submit" name="submit" value="Submit">
</form>

  <?php endif; ?>
